﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.SharePoint.Client
{

    public static class ListsExtensions
    {

        #region View, ViewCollection

        public static View FindDefaultView(this ViewCollection extendee)
        {
            return FindView(extendee, new Predicate<View>(IsDefaultViewPredicate));
        }

        public static View FindView(this ViewCollection extendee, Predicate<View> predicate)
        {
            return CommonExtensions.Find<View>(extendee, predicate);
        }

        private static bool IsDefaultViewPredicate(View view)
        {
            return view.DefaultView;
        }

        #endregion
        
    }

}